import React, {useEffect,useState} from 'react'

export default function App() {
  
  const [count, setCount] = useState(0)
  const [isHot,setIsHot] = useState(false)
  
  useEffect(() => {
    console.log('isHot执行了');
    return () => {
      console.log('isHot的Effect卸载函数'+count);
      }
      }, [isHot,count]);

  useEffect(() => {
    console.log('count执行了');
  }, [count]);



  return (
    <div>
      <h1>count的值是{count}</h1>
      <button onClick={() => {setCount(count + 1)}} >累加</button>
      <hr />
      <h2>天气真的{isHot ? '热啊' : '冷啊'}</h2>
      <button onClick={() => {setIsHot(!isHot)}}>变温</button>
    </div>
  )
}
 